package com;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.ResultSet;
import java.sql.Statement;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.connection.jdbconnection;

public class FeedbackDelete extends HttpServlet {

	Statement st=null;
	ResultSet rs=null;
	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

			doPost(request, response);
		
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		String id[] =request.getParameterValues("box");
		System.out.println(id);
			
			if(id !=null){
				try {
					jdbconnection db=new jdbconnection();
					st=db.jdbConnection();
					int b=0;
				for (int i = 0; i < id.length; i++) {
					
				
					String QString="Delete from feedback where id ='"+ id[i]+ "'";
					System.out.println(QString);
					
		b=st.executeUpdate(QString);
		
				}
			
				if(b>0)
				response.sendRedirect("AdminViewFeedback.jsp");
					
				}catch (Exception e) {
					// TODO: handle exception
					e.printStackTrace();
				}
			}
		
		
		
		
		
		
	}

	

}
